package com.example.autoconfigstudy.config;

import com.example.autoconfigstudy.CustomBean;
import com.example.autoconfigstudy.condition.OnCustomCondition;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Conditional;
import org.springframework.context.annotation.Configuration;

@Configuration
public class CustomBeanCreationConfig {

    /**
     * 当指定的条件为真的时候，someBean才会被创建
     */
    @Bean
    @Conditional(OnCustomCondition.class)
    public CustomBean someBean(){
        return new CustomBean();
    }
}
